From: Katsumi Yamaoka Date: Tue, 17 Nov 2009 22:10:40 +0000 (+0000) Subject: (rfc2047-decode-region): Don't quote decoded words containing tspecial X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~324^2~9402 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=5a36c540ff8cc59f79d61db3c08545650b5b3ae1;p=emacs.git (rfc2047-decode-region): Don't quote decoded words containing tspecial characters if they have been already quoted. -- Synch with Gnus trunk. --- diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 879673ef83d..d1738383b83 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,8 @@ +2009-11-17 Katsumi Yamaoka + + * rfc2047.el (rfc2047-decode-region): Don't quote decoded words + containing tspecial characters if they have been already quoted. + 2009-10-24 Glenn Morris * gnus-art.el (help-xref-stack-item): Define for compiler. diff --git a/lisp/gnus/rfc2047.el b/lisp/gnus/rfc2047.el index 4ba4bcb5119..78c03b49c5b 100644 --- a/lisp/gnus/rfc2047.el +++ b/lisp/gnus/rfc2047.el @@ -1026,6 +1026,7 @@ other than `\"' and `\\' in quoted strings." ;; things essentially must not be there. (while (re-search-forward "[\n\r]+" nil t) (replace-match " ")) + (setq end (point-max)) ;; Quote decoded words if there are special characters ;; which might violate RFC2822. (when (and rfc2047-quote-decoded-words-containing-tspecials @@ -1035,10 +1036,15 @@ other than `\"' and `\\' in quoted strings." (when regexp (save-restriction (widen) - (beginning-of-line) - (while (and (memq (char-after) '(? ?\t)) - (zerop (forward-line -1)))) - (looking-at regexp))))) + (and + ;; Don't quote words if already quoted. + (not (and (eq (char-before e) ?\") + (eq (char-after end) ?\"))) + (progn + (beginning-of-line) + (while (and (memq (char-after) '(? ?\t)) + (zerop (forward-line -1)))) + (looking-at regexp))))))) (let (quoted) (goto-char e) (skip-chars-forward " \t")